@function parse-random($value) {
  @return round(random() * $value);
}
$randomId: parse-random(1000000);

$spriteSrc:'/images/youban/icons.png?v=#{$randomId}';

$spriteWidth: 1379px;
$spriteHeight: 1360px;
$alert_giftboxtip: 0px -608px 545px 398px;
$alert_header: -553px -608px 535px 109px;
$back: -1290px -349px 22px 39px;
$bc: -238px -1222px 376px 35px;
$button: -1096px -608px 179px 57px;
$close: -1332px -263px 34px 34px;
$detail-btn: 0px -1298px 195px 62px;
$drawPrizeArea: -553px -933px 385px 47px;
$exchange: 0px -1014px 200px 200px;
$giftBox: -645px 0px 637px 600px;
$giftBoxOpen: 0px 0px 637px 600px;
$giftBox_login: -946px -933px 239px 44px;
$giftBoxbtn: 0px -1222px 230px 68px;
$idcard: -1290px -311px 33px 30px;
$ikonw-btn: -406px -1298px 195px 62px;
$klotteryed: -1105px -725px 171px 139px;
$left: -934px -1014px 163px 110px;
$logo: -1105px -1014px 161px 55px;
$lottery-bg-active: -208px -1014px 180px 142px;
$lottery-bg: -754px -1014px 172px 138px;
$lotteryed: -575px -1014px 171px 139px;
$mobile: -1320px -349px 23px 36px;
$prize: -599px -1164px 383px 47px;
$receive-btn: -203px -1298px 195px 62px;
$regular: -1290px -208px 89px 47px;
$right: -1290px 0px 89px 200px;
$rule: -208px -1164px 383px 47px;
$share: -1290px -263px 34px 40px;
$soon-lottery: -396px -1014px 171px 139px;
$tip: -833px -725px 264px 191px;
$tip2: -553px -725px 272px 200px;

@function px2rem ($px) {
  @if (type-of($px) == "number") {
    @return $px / 20px * 1rem;
  }
  @if (type-of($px) == "list") {
    @if (nth($px, 1) == 0 and nth($px, 2) != 0) {
      @return 0 nth($px, 2) / 20px * 1rem;
    } @else if (nth($px, 1) == 0 and nth($px, 2) == 0)  {
      @return 0 0;
    } @else if (nth($px, 1) != 0 and nth($px, 2) == 0) {
      @return nth($px, 1) / 20px * 1rem 0;
    } @else {
      @return nth($px, 1) / 20px *1rem nth($px, 2) / 20px * 1rem;
    }
  }
}

@mixin sprite-width($sprite) {
    width: px2rem(nth($sprite, 3));
}

@mixin sprite-height($sprite) {
    height: px2rem(nth($sprite, 4));
}

@mixin sprite-position($sprite) {
    $sprite-offset-x: px2rem(nth($sprite, 1));
    $sprite-offset-y: px2rem(nth($sprite, 2));
    background-position: $sprite-offset-x  $sprite-offset-y;
}

@mixin sprite($sprite) {
    @include sprite-position($sprite);
    @include sprite-width($sprite);
    @include sprite-height($sprite);
    background-image: url('#{$spriteSrc}');
    background-repeat: no-repeat;
    background-size: px2rem(($spriteWidth, $spriteHeight));
    display: inline-block;
}

@mixin mix-alert_giftboxtip() {
    @include sprite($alert_giftboxtip);
}
@mixin mix-alert_header() {
    @include sprite($alert_header);
}
@mixin mix-back() {
    @include sprite($back);
}
@mixin mix-bc() {
    @include sprite($bc);
}
@mixin mix-button() {
    @include sprite($button);
}
@mixin mix-close() {
    @include sprite($close);
}
@mixin mix-detail-btn() {
    @include sprite($detail-btn);
}
@mixin mix-drawPrizeArea() {
    @include sprite($drawPrizeArea);
}
@mixin mix-exchange() {
    @include sprite($exchange);
}
@mixin mix-giftBox() {
    @include sprite($giftBox);
}
@mixin mix-giftBoxOpen() {
    @include sprite($giftBoxOpen);
}
@mixin mix-giftBox_login() {
    @include sprite($giftBox_login);
}
@mixin mix-giftBoxbtn() {
    @include sprite($giftBoxbtn);
}
@mixin mix-idcard() {
    @include sprite($idcard);
}
@mixin mix-ikonw-btn() {
    @include sprite($ikonw-btn);
}
@mixin mix-klotteryed() {
    @include sprite($klotteryed);
}
@mixin mix-left() {
    @include sprite($left);
}
@mixin mix-logo() {
    @include sprite($logo);
}
@mixin mix-lottery-bg-active() {
    @include sprite($lottery-bg-active);
}
@mixin mix-lottery-bg() {
    @include sprite($lottery-bg);
}
@mixin mix-lotteryed() {
    @include sprite($lotteryed);
}
@mixin mix-mobile() {
    @include sprite($mobile);
}
@mixin mix-prize() {
    @include sprite($prize);
}
@mixin mix-receive-btn() {
    @include sprite($receive-btn);
}
@mixin mix-regular() {
    @include sprite($regular);
}
@mixin mix-right() {
    @include sprite($right);
}
@mixin mix-rule() {
    @include sprite($rule);
}
@mixin mix-share() {
    @include sprite($share);
}
@mixin mix-soon-lottery() {
    @include sprite($soon-lottery);
}
@mixin mix-tip() {
    @include sprite($tip);
}
@mixin mix-tip2() {
    @include sprite($tip2);
}



